package com.hd.service.activiti.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hd.dao.BaseDao;
import com.hd.entity.sys.User;
import com.hd.service.activiti.SqlConditionService;
import com.hd.service.sys.UserService;
import com.hd.util.StringUtils;
@Service("sqlConditionService")
public class SqlConditionServiceImpl implements SqlConditionService {
	@Autowired
	private BaseDao<User,String>userDao;
	@Autowired
	private UserService userService;
	/**
	 * 获取上级
	 */
	@Override
	public User getPrevSuperior(String prevUserid) {
		User user=null;
		User prevUser=userDao.get(User.class, prevUserid);
		if(StringUtils.isNotNull(prevUser.getSuperior())) {
			return userDao.get(User.class, prevUser.getSuperior());
		}
		return user;
	}
	
	/**
	 * 通过职位获取人员
	 * @param conditionId
	 * @return
	 */
	@Override
	public List<User> getByPositionId(String conditionId) {
		return userService.findByPositionId(conditionId);
	}

}
